package com.example.foodisimportant;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;

import androidx.appcompat.app.AppCompatActivity;

import com.example.foodisimportant.LoginActivity.LoginActivity;
import com.example.foodisimportant.LoginActivity.LoginTest;
import com.example.foodisimportant.StudentViewActivity.StudentViewActivity;

public class Splash extends AppCompatActivity {
    private final long SPLASH_LENGTH = 2000;
    Handler handler =new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); //隐藏状态栏
        getSupportActionBar().hide();//隐藏标题栏
        //这两步需要在setContentView前执行
        setContentView(R.layout.activity_splash);
        Thread myThread=new Thread(){
            @Override
            public void run(){
                try{
                    sleep(3000);//使程序休眠3秒
                    Intent intent=new Intent(Splash.this,StudentViewActivity.class);
                    startActivity(intent);
                    finish();//关闭
                }catch (Exception e){
                    e.printStackTrace();
                }
            }

        };//创建子线程
        myThread.start();//启动线程
    }
}
